<!DOCTYPE html>

































































<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.ico" />
<title>Optimizing Apps for Android 3.0 | Android Developers</title>
<link href="../../assets/android-developer-docs-devguide.css" rel="stylesheet" type="text/css" />
<script src="../../assets/search_autocomplete.js" type="text/javascript"></script>
<script src="../../assets/jquery-resizable.min.js" type="text/javascript"></script>
<script src="../../assets/android-developer-docs.js" type="text/javascript"></script>
<script src="../../assets/prettify.js" type="text/javascript"></script>
<script type="text/javascript">
  setToRoot("../../");
</script>
<noscript>
  <style type="text/css">
    html,body{overflow:auto;}
    #body-content{position:relative; top:0;}
    #doc-content{overflow:visible;border-left:3px solid #666;}
    #side-nav{padding:0;}
    #side-nav .toggle-list ul {display:block;}
    #resize-packages-nav{border-bottom:3px solid #666;}
  </style>
</noscript>
</head>
<body class="gc-documentation">

  <div id="header">
      <div id="headerLeft">
          <a href="../../index.html" tabindex="-1"><img
              src="../../assets/images/bg_logo.png" alt="Android Developers" /></a>
          <ul id="header-tabs" class="guide">
    
	<li id="home-link"><a href="../../offline.html">
	
		<span class="en">Home</span>
		<span style="display:none" class="de">Startseite</span>
		<span style="display:none" class="es"></span>
		<span style="display:none" class="fr"></span>
		<span style="display:none" class="it"></span>
		<span style="display:none" class="ja">ホーム</span>
		<span style="display:none" class="zh-CN">主页</span>
		<span style="display:none" class="zh-TW">首頁</span>
	
	</a></li>
	<li id="sdk-link"><a href="../../sdk/index.html">
		<span class="en">SDK</span>
	</a></li>
	<li id="guide-link"><a href="../../guide/index.html" onClick="return loadLast('guide')">
	
		<span class="en">Dev Guide</span>
		<span style="display:none" class="de">Handbuch</span>
		<span style="display:none" class="es">Guía</span>
		<span style="display:none" class="fr">Guide</span>
		<span style="display:none" class="it">Guida</span>
		<span style="display:none" class="ja">開発ガイド</span>
		<span style="display:none" class="zh-CN">开发人员指南</span>
		<span style="display:none" class="zh-TW">開發指南</span>
	
	</a></li>
	<li id="reference-link"><a href="../../reference/packages.html" onClick="return loadLast('reference')">
	
		<span class="en">Reference</span>
		<span style="display:none" class="de">Referenz</span>
		<span style="display:none" class="es">Referencia</span>
		<span style="display:none" class="fr">Référence</span>
		<span style="display:none" class="it">Riferimento</span>
		<span style="display:none" class="ja">リファレンス</span>
		<span style="display:none" class="zh-CN">参考</span>
		<span style="display:none" class="zh-TW">參考資料</span>
	
	</a></li>
	<li id="resources-link"><a href="../../resources/index.html" onClick="return loadLast('resources')">
	
		<span class="en">Resources</span>
		<span style="display:none" class="de"></span>
		<span style="display:none" class="es"></span>
		<span style="display:none" class="fr"></span>
		<span style="display:none" class="it"></span>
    		<span style="display:none" class="ja"></span>
		<span style="display:none" class="zh-CN"></span>
		<span style="display:none" class="zh-TW"></span>
	
	</a></li>
	<li id="videos-link"><a href="../../videos/index.html" onClick="return loadLast('videos')">
	
		<span class="en">Videos</span>
		<span style="display:none" class="de"></span>
		<span style="display:none" class="es"></span>
		<span style="display:none" class="fr"></span>
		<span style="display:none" class="it"></span>
		<span style="display:none" class="ja">ビデオ</span>
		<span style="display:none" class="zh-CN"></span>
		<span style="display:none" class="zh-TW"></span>
	
	</a></li>
	<li><a href="http://android-developers.blogspot.com" onClick="return requestAppendHL(this.href)">
	
		<span class="en">Blog</span>
		<span style="display:none" class="de"></span>
		<span style="display:none" class="es"></span>
		<span style="display:none" class="fr"></span>
		<span style="display:none" class="it"></span>
		<span style="display:none" class="ja">ブログ</span>
		<span style="display:none" class="zh-CN">博客</span>
		<span style="display:none" class="zh-TW">網誌</span>
	
	</a></li>


     
</ul>
     
      </div>
      <div id="headerRight">
          <div id="headerLinks">
          
          <a href="http://www.android.com">Android.com</a>
          </div>
  <div id="search" >
      <div id="searchForm">
          <form accept-charset="utf-8" class="gsc-search-box" 
                onsubmit="return submit_search()">
            <table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody>
                <tr>
                  <td class="gsc-input">
                    <input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
                      title="search developer docs" name="q"
                      value="search developer docs"
                      onFocus="search_focus_changed(this, true)"
                      onBlur="search_focus_changed(this, false)"
                      onkeydown="return search_changed(event, true, '../../')"
                      onkeyup="return search_changed(event, false, '../../')" />
                  <div id="search_filtered_div" class="no-display">
                      <table id="search_filtered" cellspacing=0>
                      </table>
                  </div>
                  </td>
                  <td class="gsc-search-button">
                    <input type="submit" value="Search" title="search" id="search-button" class="gsc-search-button" />
                  </td>
                  <td class="gsc-clear-button">
                    <div title="clear results" class="gsc-clear-button">&nbsp;</div>
                  </td>
                </tr></tbody>
              </table>
          </form>
      </div><!-- searchForm -->
  </div><!-- search -->
      </div><!-- headerRight -->
      <script type="text/javascript">
        <!--  
        changeTabLang(getLangPref());
        //-->
      </script>
  </div><!-- header -->

  <div class="g-section g-tpl-240" id="body-content">
    <div class="g-unit g-first" id="side-nav">
      <div id="devdoc-nav">
<ul>

  <li>
    <h2><span class="en">Android Basics</span>
        <span class="de" style="display:none">Einführung in Android</span>
        <span class="es" style="display:none">Información básica sobre Android</span>
        <span class="fr" style="display:none">Présentation d'Android</span>
        <span class="it" style="display:none">Nozioni di base su Android</span>
        <span class="ja" style="display:none">Android の基本</span>
        <span class="zh-CN" style="display:none">Android 基础知识</span>
        <span class="zh-TW" style="display:none">Android 簡介</span>
    </h2>
    <ul>
      <li><a href="../../guide/basics/what-is-android.html">
        <span class="en">What Is Android?</span>
        <span class="de" style="display:none">Was ist Android?</span>
        <span class="es" style="display:none">¿Qué es Android?</span>
        <span class="fr" style="display:none">Qu'est-ce qu'Android&nbsp;?</span>
        <span class="it" style="display:none">Che cos'è Android?</span>
        <span class="ja" style="display:none">Android とは</span>
        <span class="zh-CN" style="display:none">Android 是什么？</span>
        <span class="zh-TW" style="display:none">什麼是 Android？</span>
          </a></li>
      <li><a href="../../guide/topics/fundamentals.html">
        <span class="en">Application Fundamentals</span>
        <span class="de" style="display:none">Anwendungsgrundlagen</span>
        <span class="es" style="display:none">Fundamentos de las aplicaciones</span>
        <span class="fr" style="display:none">Principes de base des applications</span>
        <span class="it" style="display:none">Concetti fondamentali sulle applicazioni</span>
        <span class="ja" style="display:none">開発の基礎</span>
        <span class="zh-CN" style="display:none">应用程序基础</span>
        <span class="zh-TW" style="display:none">應用程式基本原理</span>
      </a></li>

  <!--  <li><a style="color:gray;">The Android SDK</a></li> -->
  <!--  <li><a style="color:gray;">Walkthrough for Developers</a></li> -->
      <!-- quick overview of what it's like to develop on Android -->
    </ul>
  </li>

  <li>
    <h2>
      <span class="en">Framework Topics</span>
      <span class="de" style="display:none">Framework-Themen</span>
      <span class="es" style="display:none">Temas sobre el framework</span>
      <span class="fr" style="display:none">Thèmes relatifs au framework</span>
      <span class="it" style="display:none">Argomenti relativi al framework</span>
      <span class="ja" style="display:none">フレームワーク トピック</span>
      <span class="zh-CN" style="display:none">框架主题</span>
      <span class="zh-TW" style="display:none">架構主題</span>
    </h2>
    <ul>
      <li class="toggle-list">
        <div><a href="../../guide/topics/fundamentals/activities.html">
          <span class="en">Activities</span>
        </a></div>
        <ul>
          <li><a href="../../guide/topics/fundamentals/fragments.html">
            <span class="en">Fragments</span>
          </a></li>
          <li><a href="../../guide/topics/fundamentals/loaders.html">
            <span class="en">Loaders</span>
          </a></li>
          <li><a href="../../guide/topics/fundamentals/tasks-and-back-stack.html">
            <span class="en">Tasks and Back Stack</span></a></li>
        </ul>
      </li>
      <li class="toggle-list">
        <div><a href="../../guide/topics/fundamentals/services.html">
          <span class="en">Services</span>
        </a></div>
        <ul>
          <li><a href="../../guide/topics/fundamentals/bound-services.html">
            <span class="en">Bound Services</span>
          </a></li>
        </ul>
      </li>
      <li><a href="../../guide/topics/providers/content-providers.html">
            <span class="en">Content Providers</span>
          </a></li>
      <li><a href="../../guide/topics/intents/intents-filters.html">
            <span class="en">Intents and Intent Filters</span>
          </a></li>
      <li><a href="../../guide/topics/fundamentals/processes-and-threads.html">
            <span class="en">Processes and Threads</span>
          </a></li>
    </ul>


    <ul>
      <li class="toggle-list">
        <div><a href="../../guide/topics/ui/index.html">
            <span class="en">User Interface</span>
          </a></div>
        <ul>
          <li><a href="../../guide/topics/ui/declaring-layout.html">
               <span class="en">XML Layouts</span>
              </a></li>
          <li><a href="../../guide/topics/ui/ui-events.html">
                <span class="en">Input Events</span>
              </a></li>
          <li><a href="../../guide/topics/ui/menus.html">
               <span class="en">Menus</span>
              </a></li>
          <li><a href="../../guide/topics/ui/actionbar.html">
               <span class="en">Action Bar</span>
              </a></li>
          <li><a href="../../guide/topics/ui/dialogs.html">
                <span class="en">Dialogs</span>
              </a></li>
          <li class="toggle-list">
            <div><a href="../../guide/topics/ui/notifiers/index.html">
                <span class="en">Notifications</span>
            </a></div>
            <ul>
              <li><a href="../../guide/topics/ui/notifiers/toasts.html">
                <span class="en">Toast Notifications</span>
              </a></li>
              <li><a href="../../guide/topics/ui/notifiers/notifications.html">
                <span class="en">Status Bar Notifications</span>
              </a></li>
            </ul>
          </li>
          <li><a href="../../guide/topics/ui/drag-drop.html">
                <span class="en">Drag and Drop</span>
              </a></li>
          <li><a href="../../guide/topics/ui/themes.html">
                <span class="en">Styles and Themes</span>
              </a></li>
          <li><a href="../../guide/topics/ui/custom-components.html">
                <span class="en">Custom Components</span>
              </a></li>
          <li><a href="../../guide/topics/ui/binding.html">
                <span class="en">Binding to Data with AdapterView</span>
              </a></li>
          <li><a href="../../guide/topics/ui/layout-objects.html">
                <span class="en">Common Layout Objects</span>
              </a></li>
          <li><a href="../../guide/topics/ui/how-android-draws.html">
                <span class="en">How Android Draws Views</span>
              </a></li>
        </ul>
      </li><!-- end of User Interface -->

      <li class="toggle-list">
        <div><a href="../../guide/topics/resources/index.html">
               <span class="en">Application Resources</span>
             </a></div>
        <ul>
          <li><a href="../../guide/topics/resources/providing-resources.html">
                <span class="en">Providing Resources</span>
              </a></li>
          <li><a href="../../guide/topics/resources/accessing-resources.html">
                <span class="en">Accessing Resources</span>
              </a></li>
          <li><a href="../../guide/topics/resources/runtime-changes.html">
                <span class="en">Handling Runtime Changes</span>
              </a></li>
          <li><a href="../../guide/topics/resources/localization.html">
                <span class="en">Localization</span>
              </a></li>
          <li class="toggle-list">
            <div><a href="../../guide/topics/resources/available-resources.html">
              <span class="en">Resource Types</span>
            </a></div>
            <ul>
              <li><a href="../../guide/topics/resources/animation-resource.html">Animation</a></li>
              <li><a href="../../guide/topics/resources/color-list-resource.html">Color State List</a></li>
              <li><a href="../../guide/topics/resources/drawable-resource.html">Drawable</a></li>
              <li><a href="../../guide/topics/resources/layout-resource.html">Layout</a></li>
              <li><a href="../../guide/topics/resources/menu-resource.html">Menu</a></li>
              <li><a href="../../guide/topics/resources/string-resource.html">String</a></li>
              <li><a href="../../guide/topics/resources/style-resource.html">Style</a></li>
              <li><a href="../../guide/topics/resources/more-resources.html">More Types</a></li>
            </ul>
          </li><!-- end of resource types -->
        </ul>
      </li><!-- end of app resources -->
      <li class="toggle-list">
        <div><a href="../../guide/topics/data/data-storage.html">
            <span class="en">Data Storage</span>
          </a></div>
          <ul>
            <li><a href="../../guide/topics/data/backup.html">
                <span class="en">Data Backup</span>
              </a>
            </li>
          </ul>
      </li>
      <li><a href="../../guide/topics/security/security.html">
            <span class="en">Security and Permissions</span>
          </a></li>
      <li class="toggle-list">
        <div><a href="../../guide/topics/manifest/manifest-intro.html">
          <span class="en">The AndroidManifest.xml File</span>
        </a></div>
        <ul>
          <li><a href="../../guide/topics/manifest/action-element.html">&lt;action&gt;</a></li>
          <li><a href="../../guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></li>
          <li><a href="../../guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></li>
          <li><a href="../../guide/topics/manifest/application-element.html">&lt;application&gt;</a></li>
          <li><a href="../../guide/topics/manifest/category-element.html">&lt;category&gt;</a></li>
          <li><a href="../../guide/topics/manifest/compatible-screens-element.html">&lt;compatible-screens&gt;</a></li>
          <li><a href="../../guide/topics/manifest/data-element.html">&lt;data&gt;</a></li>
          <li><a href="../../guide/topics/manifest/grant-uri-permission-element.html">&lt;grant-uri-permission&gt;</a></li>
          <li><a href="../../guide/topics/manifest/instrumentation-element.html">&lt;instrumentation&gt;</a></li>
          <li><a href="../../guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></li>
          <li><a href="../../guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></li>
          <li><a href="../../guide/topics/manifest/meta-data-element.html">&lt;meta-data&gt;</a></li>
          <li><a href="../../guide/topics/manifest/path-permission-element.html">&lt;path-permission&gt;</a></li>
          <li><a href="../../guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></li>
          <li><a href="../../guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></li>
          <li><a href="../../guide/topics/manifest/permission-tree-element.html">&lt;permission-tree&gt;</a></li>
          <li><a href="../../guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></li>
          <li><a href="../../guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></li>
          <li><a href="../../guide/topics/manifest/service-element.html">&lt;service&gt;</a></li>
          <li><a href="../../guide/topics/manifest/supports-gl-texture-element.html">&lt;supports-gl-texture&gt;</a></li>
          <li><a href="../../guide/topics/manifest/supports-screens-element.html">&lt;supports-screens&gt;</a></li><!-- ##api level 4## -->
          <li><a href="../../guide/topics/manifest/uses-configuration-element.html">&lt;uses-configuration&gt;</a></li>
          <li><a href="../../guide/topics/manifest/uses-feature-element.html">&lt;uses-feature&gt;</a></li> <!-- ##api level 4## -->
          <li><a href="../../guide/topics/manifest/uses-library-element.html">&lt;uses-library&gt;</a></li>
          <li><a href="../../guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></li>
          <li><a href="../../guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk&gt;</a></li>
        </ul>
      </li><!-- end of the manifest file -->
    </ul>

    <ul>
    <li class="toggle-list">
        <div><a href="../../guide/topics/graphics/index.html">
            <span class="en">Graphics</span>
          </a><span class="new-child">new!</span></div>
        <ul>
          <li><a href="../../guide/topics/graphics/2d-graphics.html">
              <span class="en">Canvas and Drawables</span></a></li>
          <li><a href="../../guide/topics/graphics/hardware-accel.html">
              <span class="en">Hardware Acceleration</span></a>
            <span class="new">new!</span></li>
          <li><a href="../../guide/topics/graphics/opengl.html">
              <span class="en">OpenGL</span>
            </a><span class="new">updated</span></li>
        </ul>
      </li>
      <li class="toggle-list">
        <div><a href="../../guide/topics/graphics/animation.html">
            <span class="en">Animation</span>
          </a></div>
        <ul>
          <li><a href="../../guide/topics/graphics/prop-animation.html">
              <span class="en">Property Animation</span></a></li>
          <li><a href="../../guide/topics/graphics/view-animation.html">
              <span class="en">View Animation</span></a></li>
          <li><a href="../../guide/topics/graphics/drawable-animation.html">
              <span class="en">Drawable Animation</span></a></li>
        </ul>
      </li>
      <li class="toggle-list">
	        <div><a href="../../guide/topics/renderscript/index.html">
	            <span class="en">RenderScript</span>
	          </a></div>
	        <ul>
	          <li><a href="../../guide/topics/renderscript/graphics.html">
	                <span class="en">Graphics</span>
	              </a>
	          </li>
	          <li><a href="../../guide/topics/renderscript/compute.html">
	                <span class="en">Compute</span>
	              </a>
	          </li>
	        </ul>
  	  </li>

      <li class="toggle-list">
          <div><a href="../../guide/topics/media/index.html">
            <span class="en">Multimedia and Camera</span>
          </a><span class="new">updated</span></div>
          <ul>
            <li><a href="../../guide/topics/media/mediaplayer.html">
                  <span class="en">Media Playback</span></a>
                </li>
            <li><a href="../../guide/topics/media/jetplayer.html">
                  <span class="en">JetPlayer</span></a>
                </li>
            <li><a href="../../guide/topics/media/camera.html">
                  <span class="en">Camera</span></a>
                  <span class="new">new!</span>
                </li>
            <li><a href="../../guide/topics/media/audio-capture.html">
                  <span class="en">Audio Capture</span></a>
                </li>
          </ul>
      </li>
      <li>
        <a href="../../guide/topics/clipboard/copy-paste.html">
            <span class="en">Copy and Paste</span>
        </a></li>
  <!--<li class="toggle-list">
        <div><a style="color:gray;">Sensors</a></div>
          <ul>
            <li><a style="color:gray;">Camera</a></li>
            <li><a style="color:gray;">Compass</a></li>
            <li><a style="color:gray;">Accelerometer</a></li>
          </ul>
      </li> -->
      <li class="toggle-list">
        <div><a href="../../guide/topics/location/index.html">
               <span class="en">Location and Maps</span>
             </a></div>
        <ul>
          <li><a href="../../guide/topics/location/obtaining-user-location.html">
                <span class="en">Obtaining User Location</span>
              </a></li>
        </ul>
      </li>
  <!--<li class="toggle-list">
        <div><a style="color:gray;">Wireless Controls</a></div>
          <ul>
            <li><a style="color:gray;">Wi-Fi</a></li>
          </ul>
      </li> -->
  <!--<li><a style="color:gray;">Localization</a></li>  -->
      <li><a href="../../guide/topics/appwidgets/index.html">
            <span class="en">App Widgets</span></a>
          </li>
      <li><a href="../../guide/topics/wireless/bluetooth.html">
            <span class="en">Bluetooth</span></a>
          </li>
      <li><a href="../../guide/topics/nfc/index.html">
            <span class="en">Near Field Communication</span>
          </a></li>
      <li class="toggle-list">
          <div><a href="../../guide/topics/usb/index.html">
            <span class="en">USB</span></a>
          </div>
            <ul>
              <li><a href="../../guide/topics/usb/accessory.html">Accessory</a></li>
              <li><a href="../../guide/topics/usb/host.html">Host</a></li>
              <li><a href="../../guide/topics/usb/adk.html">Open Accessory Dev Kit</a></li>
            </ul>
          </li>

       <li><a href="../../guide/topics/network/sip.html">
            <span class="en">Session Initiation Protocol</span>
          </a></li>
      <li class="toggle-list">
        <div><a href="../../guide/topics/search/index.html">
            <span class="en">Search</span>
          </a></div>
          <ul>
            <li><a href="../../guide/topics/search/search-dialog.html">Creating a Search Interface</a></li>
            <li><a href="../../guide/topics/search/adding-recent-query-suggestions.html">Adding Recent Query Suggestions</a></li>
            <li><a href="../../guide/topics/search/adding-custom-suggestions.html">Adding Custom Suggestions</a></li>
            <li><a href="../../guide/topics/search/searchable-config.html">Searchable Configuration</a></li>
          </ul>
      </li>
      <li><a href="../../guide/topics/admin/device-admin.html">
            <span class="en">Device Administration</span></a>
      </li>
      <li class="toggle-list">
           <div>
                <a href="../../guide/topics/testing/index.html">
                   <span class="en">Testing</span>
               </a>
           </div>
           <ul>
              <li>
                <a href="../../guide/topics/testing/testing_android.html">
                <span class="en">Testing Fundamentals</span></a>
              </li>
              <li>
                <a href="../../guide/topics/testing/activity_testing.html">
                <span class="en">Activity Testing</span></a>
              </li>
              <li>
                <a href="../../guide/topics/testing/contentprovider_testing.html">
                <span class="en">Content Provider Testing</span></a>
              </li>
              <li>
                <a href="../../guide/topics/testing/service_testing.html">
                <span class="en">Service Testing</span></a>
              </li>
              <li>
                <a href="../../guide/topics/testing/what_to_test.html">
                <span class="en">What To Test</span></a>
              </li>
           </ul>
      </li>
    </ul>
  </li>

  <li>
    <h2>
      <span class="en">Android Market Topics</span>
    </h2>
    <ul>
      <li><a href="../../guide/publishing/licensing.html">
          <span class="en">Application Licensing</span></a>
      </li>
      <li class="toggle-list">
        <div><a href="../../guide/market/billing/index.html">
            <span class="en">In-app Billing</span></a>
        </div>
        <ul>
          <li><a href="../../guide/market/billing/billing_overview.html">
              <span class="en">In-app Billing Overview</span></a>
          </li>
          <li><a href="../../guide/market/billing/billing_integrate.html">
              <span class="en">Implementing In-app Billing</span></a>
          </li>
          <li><a href="../../guide/market/billing/billing_best_practices.html">
              <span class="en">Security and Design</span></a>
          </li>
          <li><a href="../../guide/market/billing/billing_testing.html">
              <span class="en">Testing In-app Billing</span></a>
          </li>
          <li><a href="../../guide/market/billing/billing_admin.html">
              <span class="en">Administering In-app Billing</span></a>
          </li>
          <li><a href="../../guide/market/billing/billing_reference.html">
              <span class="en">In-app Billing Reference</span></a>
          </li>
        </ul>
      </li>
      <li><a href="../../guide/appendix/market-filters.html">
          <span class="en">Market Filters</span></a>
      </li>
      <li><a href="../../guide/market/publishing/multiple-apks.html">
          <span class="en">Multiple APK Support</span></a>
      </li>
    </ul>
  </li>


  <li>
    <h2><span class="en">Developing</span>
               <span class="de" style="display:none">Entwicklung</span>
               <span class="es" style="display:none">Desarrollo</span>
               <span class="fr" style="display:none">Développement</span>
               <span class="it" style="display:none">Sviluppo</span>
               <span class="ja" style="display:none">開発</span>
               <span class="zh-CN" style="display:none">开发</span>
               <span class="zh-TW" style="display:none">開發</span>
    </h2>
    <ul>
  <!--<li><a href="">Developing for Android</a></li>
      signing, upgrading, selecting a package name, select device profile, touch, trackball, dpad available, etc. -->
      <li>
        <a href="../../guide/developing/index.html">
        <span class="en">Introduction</span></a>
      </li>

      <li class="toggle-list">
        <div>
           <a href="../../guide/developing/devices/index.html">
                <span class="en">Managing Virtual Devices</span>
            </a>
        </div>
        <ul>
          <li>
            <a href="../../guide/developing/devices/managing-avds.html">
              <span class="en">With AVD Manager</span>
            </a>
          </li>
          <li>
            <a href="../../guide/developing/devices/managing-avds-cmdline.html">
              <span class="en">From the Command Line</span>
            </a>
          </li>
          <li>
           <a href="../../guide/developing/devices/emulator.html">
                <span class="en">Using the Android Emulator</span>
            </a>
          </li>
        </ul>
      </li>
      <li>
        <a href="../../guide/developing/device.html">
          <span class="en">Using Hardware Devices</span>
        </a>
      </li>

      <li class="toggle-list">
        <div>
          <a href="../../guide/developing/projects/index.html">
            <span class="en">Managing Projects</span>
          </a>
        </div>
        <ul>
          <li>
            <a href="../../guide/developing/projects/projects-eclipse.html">
              <span class="en">From Eclipse with ADT</span>
            </a>
          </li>
          <li>
            <a href="../../guide/developing/projects/projects-cmdline.html">
                <span class="en">From the Command Line</span>
            </a>
          </li>
        </ul>
      </li>

      <li class="toggle-list">
        <div>
          <a href="../../guide/developing/building/index.html">
            <span class="en">Building and Running</span>
          </a>
        </div>
        <ul>
          <li><a href="../../guide/developing/building/building-eclipse.html">
            <span class="en">From Eclipse with ADT</span>
          </a></li>
          <li><a href="../../guide/developing/building/building-cmdline.html">
            <span class="en">From the Command Line</span></a></li>
        </ul>
      </li>

      <li class="toggle-list">
        <div>
          <a href="../../guide/developing/debugging/index.html">
            <span class="en">Debugging</span>
          </a>
        </div>
        <ul>
          <li>
            <a href="../../guide/developing/debugging/debugging-projects.html">
                <span class="en">From Eclipse with ADT</span>
            </a>
          </li>
          <li>
            <a href="../../guide/developing/debugging/debugging-projects-cmdline.html">
                <span class="en">From Other IDEs</span>
            </a>
          </li>
          <li>
            <a href="../../guide/developing/debugging/ddms.html">
              <span class="en">Using DDMS</span>
            </a>
          </li>
          <li>
            <a href="../../guide/developing/debugging/debugging-log.html">
                <span class="en">Reading and Writing Logs</span>
            </a>
          </li>
          <li>
            <a href="../../guide/developing/debugging/debugging-ui.html">
                <span class="en">Debugging and Profiling UIs</span>
            </a>
          </li>
          <li>
            <a href="../../guide/developing/debugging/debugging-tracing.html">
                <span class="en">Profiling with Traceview and dmtracedump</span>
            </a>
          </li>
          <li>
            <a href="../../guide/developing/debugging/debugging-devtools.html">
                <span class="en">Using the Dev Tools App</span>
            </a>
          </li>
        </ul>
      </li>

      <li class="toggle-list">
           <div>
                <a href="../../guide/developing/testing/index.html">
                   <span class="en">Testing</span>
               </a>
           </div>
           <ul>
              <li>
                <a href="../../guide/developing/testing/testing_eclipse.html">
                  <span class="en">From Eclipse with ADT</span>
                </a>
              </li>

              <li>
                <a href="../../guide/developing/testing/testing_otheride.html">
                  <span class="en">From Other IDEs</span>
                </a>
              </li>
           </ul>
         </li>

         <li class="toggle-list">
        <div><a href="../../guide/developing/tools/index.html">
            <span class="en">Tools</span>
          </a></div>
        <ul>
          <li><a href="../../guide/developing/tools/adb.html">adb</a></li>
          <li><a href="../../guide/developing/tools/adt.html">ADT</a></li>
          <li><a href="../../guide/developing/tools/android.html">android</a></li>
          <li><a href="../../guide/developing/tools/bmgr.html">bmgr</a>
          <li><a href="../../guide/developing/tools/dmtracedump.html">dmtracedump</a></li>
          <li><a href="../../guide/developing/tools/draw9patch.html">Draw
          9-Patch</a></li>
          <li><a href="../../guide/developing/tools/emulator.html">Emulator</a></li>
          <li><a href="../../guide/developing/tools/etc1tool.html">etc1tool</a></li>
          <li><a href="../../guide/developing/tools/hierarchy-viewer.html">Hierarchy Viewer</a></li>
          <li><a href="../../guide/developing/tools/hprof-conv.html">hprof-conv</a></li>
          <li><a href="../../guide/developing/tools/layoutopt.html">layoutopt</a></li>
          <li><a href="../../guide/developing/tools/logcat.html">logcat</a></li>
          <li><a href="../../guide/developing/tools/mksdcard.html">mksdcard</a></li>
          <li><a href="../../guide/developing/tools/monkey.html">Monkey</a></li>
          <li class="toggle-list">
            <div><a href="../../guide/developing/tools/monkeyrunner_concepts.html">
              <span class="en">monkeyrunner</span>
            </a></div>
            <ul>
              <li><a href="../../guide/developing/tools/MonkeyDevice.html">
                <span class="en">MonkeyDevice</span>
                </a></li>
              <li><a href="../../guide/developing/tools/MonkeyImage.html">
                <span class="en">MonkeyImage</span>
                </a></li>
              <li><a href="../../guide/developing/tools/MonkeyRunner.html">
                <span class="en">MonkeyRunner</span>
                </a></li>
            </ul>
          </li>
          <li><a href="../../guide/developing/tools/proguard.html">ProGuard</a></li>
          <li><a href="../../guide/developing/tools/adb.html#sqlite">sqlite3</a></li>
          <li><a href="../../guide/developing/tools/traceview.html">Traceview</a></li>
          <li><a href="../../guide/developing/tools/zipalign.html">zipalign</a></li>
        </ul>
      </li>
    </ul>
  </li>

  <li>
    <h2><span class="en">Publishing</span>
        <span class="de" style="display:none">Veröffentlichung</span>
        <span class="es" style="display:none">Publicación</span>
        <span class="fr" style="display:none">Publication</span>
        <span class="it" style="display:none">Pubblicazione</span>
        <span class="ja" style="display:none">公開</span>
        <span class="zh-CN" style="display:none">发布</span>
        <span class="zh-TW" style="display:none">發佈</span>
    </h2>
    <ul>
      <li><a href="../../guide/publishing/app-signing.html">
            <span class="en">Signing Your Applications</span>
            <span class="de" style="display:none">Signieren Ihrer Anwendungen</span>
            <span class="es" style="display:none">Firma de aplicaciones</span>
            <span class="fr" style="display:none">Attribution de votre signature <br />à vos applications</span>
            <span class="it" style="display:none">Firma delle applicazioni</span>
            <span class="ja" style="display:none">アプリケーションへの署名</span>
            <span class="zh-CN" style="display:none">应用程序签名</span>
            <span class="zh-TW" style="display:none">簽署應用程式</span>
          </a></li>
      <li><a href="../../guide/publishing/versioning.html">
            <span class="en">Versioning Your Applications</span>
            <span class="de" style="display:none">Versionsverwaltung für Ihre <br />Anwendungen</span>
            <span class="es" style="display:none">Versiones de las aplicaciones</span>
            <span class="fr" style="display:none">Attribution d'une version à vos applications</span>
            <span class="it" style="display:none">Controllo versioni delle applicazioni</span>
            <span class="ja" style="display:none">アプリケーションのバージョニング</span>
            <span class="zh-CN" style="display:none">应用程序版本控制</span>
            <span class="zh-TW" style="display:none">應用程式版本設定</span>
          </a></li>
      <li><a href="../../guide/publishing/preparing.html">
            <span class="en">Preparing to Publish</span>
            <span class="de" style="display:none">Vorbereitung auf die Veröffentlichung</span>
            <span class="es" style="display:none">Publicación de aplicaciones</span>
            <span class="fr" style="display:none">Préparation à la publication</span>
            <span class="it" style="display:none">Preparativi per la pubblicazione</span>
            <span class="ja" style="display:none">公開の準備</span>
            <span class="zh-CN" style="display:none">准备发布</span>
            <span class="zh-TW" style="display:none">準備發佈</span>
          </a></li>
      <li><a href="../../guide/publishing/publishing.html">
            <span class="en">Publishing on Android Market</span>
          </a></li>
    </ul>
  </li>

  <li>
    <h2><span class="en">Best Practices</span>
               <span class="de" style="display:none">Bewährte Verfahren</span>
               <span class="es" style="display:none">Prácticas recomendadas</span>
               <span class="fr" style="display:none">Meilleures pratiques</span>
               <span class="it" style="display:none">Best practice</span>
               <span class="ja" style="display:none">ベスト プラクティス</span>
               <span class="zh-CN" style="display:none">最佳实践</span>
               <span class="zh-TW" style="display:none">最佳實務</span>
    </h2>
    <ul>
      <li><a href="../../guide/practices/compatibility.html">
            <span class="en">Compatibility</span>
          </a></li>
      <li class="toggle-list">
        <div><a href="../../guide/practices/screens_support.html">
          <span class="en">Supporting Multiple Screens</span>
        </a></div>
        <ul>
          <li><a href="../../guide/practices/screens-distribution.html">
            <span class="en">Distributing to Specific Screens</span>
          </a></li>
          <li><a href="../../guide/practices/screen-compat-mode.html">
            <span class="en">Screen Compatibility Mode</span>
          </a></li>
          <li><a href="../../guide/practices/screens-support-1.5.html">
            <span class="en">Strategies for Android 1.5</span>
          </a></li>
        </ul>
      </li>
      <li><a href="../../guide/practices/optimizing-for-3.0.html">
            <span class="en">Optimizing Apps for Android 3.0</span>
          </a></li>
      <li class="toggle-list">
        <div><a href="../../guide/practices/ui_guidelines/index.html">
               <span class="en">UI Guidelines</span>
             </a></div>
        <ul>
          <li class="toggle-list">
            <div><a href="../../guide/practices/ui_guidelines/icon_design.html">
                   <span class="en">Icon Design <span class="new">updated</span></span>
                 </a></div>
            <ul>
              <li><a href="../../guide/practices/ui_guidelines/icon_design_launcher.html">
                    <span class="en">Launcher Icons <span class="new">updated</span></span>
                  </a></li>
              <li><a href="../../guide/practices/ui_guidelines/icon_design_menu.html">
                    <span class="en">Menu Icons</span>
                  </a></li>
              <li><a href="../../guide/practices/ui_guidelines/icon_design_action_bar.html">
                    <span class="en">Action Bar Icons <span class="new">new!</span></span>
                  </a></li>
              <li><a href="../../guide/practices/ui_guidelines/icon_design_status_bar.html">
                    <span class="en">Status Bar Icons <span class="new">updated</span></span>
                  </a></li>
              <li><a href="../../guide/practices/ui_guidelines/icon_design_tab.html">
                    <span class="en">Tab Icons</span>
                  </a></li>
              <li><a href="../../guide/practices/ui_guidelines/icon_design_dialog.html">
                    <span class="en">Dialog Icons</span>
                  </a></li>
              <li><a href="../../guide/practices/ui_guidelines/icon_design_list.html">
                    <span class="en">List View Icons</span>
                  </a></li>
            </ul>
          </li>
          <li><a href="../../guide/practices/ui_guidelines/widget_design.html">
                <span class="en">App Widget Design <span class="new">updated</span></span>
              </a></li>
          <li><a href="../../guide/practices/ui_guidelines/activity_task_design.html">
                <span class="en">Activity and Task Design</span>
              </a></li>
          <li><a href="../../guide/practices/ui_guidelines/menu_design.html">
                <span class="en">Menu Design</span>
              </a></li>
        </ul>
      </li>
      </ul>
      <ul>
      <li><a href="../../guide/practices/design/accessibility.html">
            <span class="en">Designing for Accessibility</span>
          </a></li>
      <li class="toggle-list">
        <div><a href="../../guide/practices/design/performance.html">
            <span class="en">Designing for Performance</span>
          </a></div>
        <ul>
          <li><a href="../../guide/practices/design/jni.html">
                <span class="en">JNI Tips</span>
              </a></li>
        </ul>
      </li>
      <li><a href="../../guide/practices/design/responsiveness.html">
            <span class="en">Designing for Responsiveness</span>
          </a></li>
      <li><a href="../../guide/practices/design/seamlessness.html">
            <span class="en">Designing for Seamlessness</span>
          </a></li>
    </ul>
  </li>

  <li>
    <h2><span class="en">Web Applications</span>
    </h2>
    <ul>
      <li><a href="../../guide/webapps/index.html">
            <span class="en">Web Apps Overview</span>
          </a></li>
      <li><a href="../../guide/webapps/targeting.html">
            <span class="en">Targeting Screens from Web Apps</span>
          </a></li>
      <li><a href="../../guide/webapps/webview.html">
            <span class="en">Building Web Apps in WebView</span>
          </a></li>
      <li><a href="../../guide/webapps/debugging.html">
            <span class="en">Debugging Web Apps</span>
          </a></li>
      <li><a href="../../guide/webapps/best-practices.html">
            <span class="en">Best Practices for Web Apps</span>
          </a></li>
    </ul>
  </li>

  <li>
    <h2><span class="en">Appendix</span>
               <span class="de" style="display:none">Anhang</span>
               <span class="es" style="display:none">Apéndice</span>
               <span class="fr" style="display:none">Annexes</span>
               <span class="it" style="display:none">Appendice</span>
               <span class="ja" style="display:none">付録</span>
               <span class="zh-CN" style="display:none">附录</span>
               <span class="zh-TW" style="display:none">附錄</span>
    </h2>
    <ul>
      <li><a href="../../guide/appendix/api-levels.html">
            <span class="en">Android API Levels</span>
          </a></li>
      <li><a href="../../guide/appendix/install-location.html">
            <span class="en">App Install Location</span>
          </a></li>
      <li><a href="../../guide/appendix/media-formats.html">
            <span class="en">Supported Media Formats <span class="new">updated</span></span>
          </a></li>
      <li><a href="../../guide/appendix/g-app-intents.html">
            <span class="en">Intents List: Google Apps</span>
          </a></li>
      <li><a href="../../guide/developing/tools/aidl.html">AIDL</a></li>
      <li><a href="../../guide/appendix/glossary.html">
            <span class="en">Glossary</span>
          </a></li>
    </ul>
  </li>

</ul>

<script type="text/javascript">
<!--
    buildToggleLists();
    changeNavLang(getLangPref());
//-->
</script>

      </div>
    </div> <!-- end side-nav -->
    <script>
      addLoadEvent(function() {
        scrollIntoView("devdoc-nav");
        });
    </script>




<div class="g-unit" id="doc-content"><a name="top"></a>

<div id="jd-header" class="guide-header">
  <span class="crumb">
    &nbsp;
    
  </span>
<h1>Optimizing Apps for Android 3.0</h1>
</div>

  <div id="jd-content">

    <div class="jd-descr">
    <div id="qv-wrapper">
<div id="qv">
<h2>In this document</h2>
<ol>
<li><a href="#Setup">Setting Up Your SDK with Android 3.0</a></li>
<li><a href="#Optimizing">Optimizing Your App for Tablets</a></li>
<li><a href="#Upgrading">Upgrading or Developing a New App for Tablets</a></li>
<li><a href="#ManagingAppDist">Managing App Distribution Based on Screen Configuration</a>
  <ol>
    <li><a href="#FilteringTabletApps">Filtering a tablet app from mobile devices</a></li>
    <li><a href="#FilteringMobileApps">Filtering a mobile device app from tablets</a></li>
  </ol>
</li>
<li><a href="#Issues">Other Issues</a>
  <ol>
    <li><a href="#Landscape">Adding support for landscape screens</a></li>
    <li><a href="#Telephony">Using telephony or other variable features</a></li>
  </ol>
</li>
</ol>

<h2>See also</h2>

<ol>
  <li><a
href="../../sdk/compatibility-library.html">Compatibility Library</a></li>
  <li><a href="http://code.google.com/p/iosched/">Google I/O App source code</a></li>
</ol>

</div>
</div>

<p>Android 3.0 introduces several features that allow
you to enhance your user's experience on tablets and similar devices. Any application you've already
published is compatible with devices running Android 3.0, by default, because Android applications
are forward-compatible. However, new tablet devices running Android 3.0 are now available to the
public and provide users a new Android experience on a larger screen, so you should make sure
your application looks and works great on the new platform and new device form-factors.</p>

<p>This document shows how you can optimize your existing application for Android 3.0 and
maintain compatibility with older versions or upgrade your application completely with new APIs.</p>


<p><b>To get started:</b></p>

<ol>
  <li><a href="#Setup">Set up your SDK with Android 3.0</a>.
    <p>Install the Android 3.0 platform, new tools, and set up a new AVD.</p></li>
  <li>Choose to either optimize or upgrade:
    <ol type="a">
      <li><a href="#Optimizing">Optimize your app for tablets and similar devices</a>.
        <p>Read this section if you have an existing application and want to
maintain compatibility with older versions of Android. All you need to do is update your
manifest file to declare support for Android 3.0, test your application on the new platform, and
add extra resources to support extra large screens, as appropriate.</p>
      </li>
      <li><a href="#Upgrading">Upgrade or develop a new app for tablets and similar devices</a>.
        <p>Read this section if you want to upgrade your application to use APIs introduced in
Android 3.0 or create a new application targeted to tablets and similar devices. Compared to
upgrading to previous versions of Android, there's nothing different about upgrading to Android 3.0.
This section introduces some of the key features and APIs you should use to make an
application that's fully enhanced for tablets.</p></li>
    </ol>
  </li>
  <li>Consider whether you need to <a href="#ManagingAppDist">manage the distribution of your
application based on screen configuration</a>.</li>
  <li>Then review some <a href="#Issue">other issues</a> you might encounter when developing
for tablets and similar devices.</li>
</ol>


<h2 id="Setup">Set Up Your SDK with Android 3.0</h2>

<p>To start testing and developing your application on Android 3.0, set up your existing Android
SDK with the new platform:</p>

<p>(If you don't have an existing Android SDK, <a href="../../sdk/index.html">download the
SDK starter package now</a>.)</p>

<ol>
  <li><a href="../../sdk/adding-components.html#launching">Launch the Android SDK and AVD
Manager</a> and install the following:
    <ul>
      <li>SDK Platform Android 3.0</li>
      <li>Android SDK Tools, revision 10</li>
      <li>Android SDK Platform-tools, revision 3</li>
      <li>Documentation for Android SDK, API 11</li>
      <li>Samples for SDK API 11</li>
    </ul>
  </li>
  <li><a href="../../guide/developing/other-ide.html#AVD">Create an AVD</a> for a tablet-type
device:
  <p>Set the target to "Android 3.0" and the skin to "WXGA" (the default skin).</p></li>
</ol>

<p>The best way to test your application on Android 3.0 is to use real hardware running Android 3.0,
such as the <a href="http://www.motorola.com/staticfiles/Consumers/XOOM/index.html">Motorola
Xoom</a>. Of course, you can also use the Android emulator on your development machine, but because
the Android emulator must simulate the ARM instruction set on your computer and the WXGA screen is
significantly larger than a typical virtual device, emulator performance is much slower than a real
device.</p>

<h3>About emulator performance</h3>

<p>Initializing the emulator can be slow and can take several minutes, depending on
your hardware. When the emulator is booting, there is limited user feedback, so please be patient
and wait until you see the home screen (or lock screen) appear. </p>

<p>However, you don't need to boot the emulator each time you rebuild your
application&mdash;typically you only need to boot at the start of a session and keep it running.
Also see the tip below for information about using a snapshot to drastically reduce startup time
after the first initialization. </p>

<p>General performance in the emulator is also slow. We're working hard to resolve the performance
issues and it will improve in future tools releases. If you don't yet have a real device running
Android 3.0, the emulator is still best way to evaluate your application's appearance and
functionality on Android 3.0.</p>

<p class="note"><strong>Tip:</strong> To improve the startup time for the emulator, enable snapshots
for the AVD when you create it with the SDK and AVD Manager (there's a checkbox in the AVD creator
to <strong>Enable</strong> snapshots). Then, start the AVD from the AVD manager and check <b>Launch
from snapshot</b> and <b>Save to snapshot</b>. This way, when you close the emulator, a snapshot of
the AVD state is saved and used to quickly relaunch the AVD next time. However, when you choose to
save a snapshot, the emulator will be slow to close, so you might want to disable <b>Save to
snapshot</b> after you've acquired an initial snapshot (after you close the AVD for the first
time).</p>



<h2 id="Optimizing">Optimizing Your App for Tablets</h2>

<p>If you've already developed an application for an earlier version of Android, there are a few
things you can do to optimize it for a tablet-style experience on Android 3.0 without changing the
minimum version required (you don't need to change your manifest's <a
href="../../guide/topics/manifest/uses-sdk-element.html#min"><code>android:minSdkVersion</code></a>).</p>

<p class="note"><strong>Note:</strong> All Android applications are forward-compatible, so
there's nothing you <em>have to</em> do&mdash;if your application is a good citizen of the Android
APIs, your app should work fine on devices running Android 3.0. However, in order to provide users
a better experience when using your app on an Android 3.0 tablet or similar-size device, you
should update your application to inherit the new system theme and provide some optimizations for
larger screens.</p>

<p>Here are a few things you can do to optimize your application for devices running Android
3.0:</p>

<ol>
  <li><b>Test your current application on Android 3.0</b>
    <ol>
      <li>Build your application as-is and install it on your Android 3.0 AVD (created above during
<a href="#Setup">setup</a>).</li>
      <li>Perform your usual tests to be sure everything works and looks as expected.</li>
    </ol>
  </li>
  
  <li><b>Apply the new "holographic" theme to your application</b>
    <ol>
      <li>Open your manifest file and update the <a
href="../../guide/topics/manifest/uses-sdk-element.html"><code>&lt;uses-sdk&gt;</code></a> element to
set <a
href="../../guide/topics/manifest/uses-sdk-element.html#target"><code>android:targetSdkVersion</code></a> to <code>"11"</code>. For example:
<pre>
&lt;manifest ... >
    &lt;uses-sdk android:minSdkVersion="4" 
              android:targetSdkVersion="11" /&gt;
    &lt;application ... >
        ...
    &lt;application>
&lt;/manifest>
</pre>
    <p>By targeting the Android 3.0 platform, the system automatically applies the holographic theme
to each activity when your application runs on an Android 3.0 device. The holographic theme
provides a new design for widgets, such as buttons and text boxes, and new styles for other
visual elements. This is the standard theme for applications built for Android 3.0, so your
application will look and feel consistent with the system and other applications when it is
enabled.</p>
    <p>Additionally, when an activity uses the holographic theme, the system enables the <a
href="../../guide/topics/ui/actionbar.html">Action Bar</a> for the activity and removes the
Options Menu button in the system bar. The Action Bar
replaces the traditional title bar at the top of the activity window and provides the user access to
the activity's Options Menu.</p>
      </li>
      <li>Build your application against the same version of the Android platform you have been
using previously (such as the version declared in your <a
href="../../guide/topics/manifest/uses-sdk-element.html#min"><code>android:minSdkVersion</code></a>),
but install it on the Android 3.0 AVD. (You should not build against Android 3.0 unless you are
using new APIs.) Repeat your tests to be sure that your user interface works well with the
holographic theme.
        <p class="note"><strong>Note:</strong> If you have applied other themes directly to your
activities, they will override the inherited holographic theme. To resolve this, you can use
the <a href="../../guide/topics/resources/providing-resources.html#VersionQualifier">platform
version qualifier</a> to provide an alternative theme for Android 3.0 devices that's based on the
holographic theme. For more information, read how to <a
href="../../guide/topics/ui/themes.html#SelectATheme">select a theme based on platform
version</a>.</p>
    </ol>
  </li>

  <li><b>Supply alternative layout resources for xlarge screens</b>
    <p>By providing <a
href="../../guide/topics/resources/providing-resources.html#AlternativeResources">alternative
resources</a> when running on extra large screens (using the <code>xlarge</code> resource
qualifier), you can improve the user experience of your application on tablet-type devices without
using new APIs.</p>
    <p>For example, here are some things to consider when creating a new layout for extra large
screens:</p>
    <ul>
      <li>Landscape layout: The "normal" orientation for tablet-type devices is usually landscape
(wide), so you should be sure that your activities offer a layout that's optimized for a wide
viewing area. <p>You can specify landscape resources with the <code>land</code> resource
qualifier, but if you want alternative resources for an extra large landscape screen, you
should use both the <code>xlarge</code> and <code>land</code> qualifiers. For example, <code>res/layout-xlarge-land/</code>. The order of the qualifier names is important; see <a
href="../../guide/topics/resources/providing-resources.html#AlternativeResources">
Providing Alternative Resources</a> for more information.</p></li>
      <li>Button position and size: Consider whether the position and size of the most common
buttons in your UI make them easily accessible while holding a tablet with two hands. In some
cases, you might need to resize buttons, especially if they use <code>"wrap_content"</code>
as the width value. To enlarge the buttons, if necessary, you should either: add
extra padding to the button; specify dimension values with <code>dp</code> units; or use <code>android:layout_weight</code> when the button is in a <a
href="../../guide/topics/ui/layout-objects.html#linearlayout">linear layout</a>. Use your
best judgment of proportions for each screen size&mdash;you don't want the buttons to be too big,
either.</li>
      <li>Font sizes: Be sure your application uses <code>sp</code> units when setting font
sizes. This alone should ensure a readable experience on tablet-style devices, because it is a
scale-independent pixel unit, which will resize as appropriate for the current screen configuration.
In some cases, however, you still might want to consider larger font sizes for <code>xlarge</code>
configurations.</li>
    </ul>
    <p>In general, always be sure that your application follows the <a
href="../../guide/practices/screens_support.html#screen-independence">Best Practices
for Screen Independence</a>.</p>
  </li>
</ol>




<h2 id="Upgrading">Upgrading or Developing a New App for Tablets</h2>

<div class="sidebox-wrapper">
<div class="sidebox">
  <h3>Use the Compatibility Library to remain backward-compatible</h3>
<p>It is possible for you to upgrade your application with some new
APIs <em>and</em> remain compatible with older versions of Android. Usually, this requires that you
use techniques such as reflection to check for the availability of certain APIs at runtime. However,
to help you add features from Android 3.0 without requiring you to change your <a
href="../../guide/topics/manifest/uses-sdk-element.html#min"><code>android:minSdkVersion</code></a>
or build target, we're providing a static library called the <a
href="../../sdk/compatibility-library.html">Compatibility Library</a>
(downloadable from the AVD and SDK Manager).</p>
<p>This library includes APIs for <a
href="../../guide/topics/fundamentals/fragments.html">fragments</a>, <a
href="../../guide/topics/fundamentals/loaders.html">loaders</a>, and some updated classes. By
simply adding this library to your Android project, you can use these APIs in your application and
remain compatible with Android 1.6. For information about how to get the library and start
using it in your application, see the <a
href="../../sdk/compatibility-library.html">Compatibility Library</a> document.</p>
</div>
</div>


<p>If you want to develop an application that's fully enhanced for tablet-type devices running
Android 3.0, then you need to use new APIs in Android 3.0. This section introduces some of
the new features you should use.</p>


<h3>Declare the minimum system version</h3>

<p>The first thing to do when you upgrade or create a project for Android 3.0 is set your manifest's
<a href="../../guide/topics/manifest/uses-sdk-element.html#min"><code>android:minSdkVersion</code></a> to <code>"11"</code>. This declares that your application uses APIs available
in Android 3.0 and greater, so it should not be available to devices running an older version of
Android. For example:</p>

<pre>
&lt;manifest ... >
    &lt;uses-sdk android:minSdkVersion="11" /&gt;
    &lt;application ... >
        ...
    &lt;application>
&lt;/manifest>
</pre>

<p>Not only is this necessary in order to declare the minimum API level your application requires,
but it enables the new holographic theme to each of your activities. The holographic theme is the
standard theme for the Android 3.0 system and all applications designed for it. It includes new
designs for the system widgets and overall appearance.</p>

<p>Additionally, the holographic theme enables the Action Bar for each activity.</p>


<h3>Use the Action Bar</h3>

<p>The Action Bar is a widget for activities that replaces the traditional title bar at the top of
the screen. By default, the Action Bar includes the application logo on the left side, followed by
the activity title, and access to items from the Options Menu in a drop-down list on the right
side.</p>

<p>You can enable items from the Options Menu to appear directly in the Action Bar as
"action items" by adding <code>showAsAction="ifRoom"</code> to specific menu items in your <a
href="../../guide/topics/resources/menu-resource.html">menu resource</a>. You can also add
navigation features to the Action Bar, such as tabs, and use the application icon to navigate to
your application's "home" activity or to navigate "up" the application's activity hierarchy.</p>

<p>For more information, read <a href="../../guide/topics/ui/actionbar.html">Using the
Action Bar</a>.</p>



<h3>Divide your activities into fragments</h3>

<p>A fragment represents a behavior or a portion of user interface in an activity. You can think of
a fragment as a modular section of an activity, which has its own lifecycle, receives its own input
events, and which you can add or remove while the activity is running. Fragments are an optional
component for your activities that allow you to build a multi-pane UI and reuse them in multiple
activities. If you're building an application for tablets, we recommend that you use fragments to
create activities that offer a more dynamic and flexible user interface.</p>

<p>For example, a news application can use one fragment to show a list of articles on the left and
another fragment to display an article on the right&mdash;both fragments appear in one activity,
side by side, and each fragment has its own set of lifecycle callback methods and handles its own
input events. Thus, instead of using one activity to select an article and another activity to
read the article, the user can select an article and read it all within the same activity.</p>

<p>For more information, read the <a
href="../../guide/topics/fundamentals/fragments.html">Fragments</a> document.</p>


<h3>Use new animation APIs for transitions</h3>

<p>An all-new animation framework allows you to animate arbitrary properties of any object
(such as a View, Drawable, Fragment, or anything else). You can define several animation aspects
(such as duration, repeat, interpolation, and more) for an object's int, float, and hexadecimal
color values, by default. That is, when an object has a property field for one of these types, you
can change its value over time to affect an animation.</p>

<p>The <code><a href="../../reference/android/view/View.html">View</a></code> class also provides new APIs that leverage the new animation
framework, allowing you to easily apply 2D and 3D transformations to views in your activity layout.
New transformations are made possible with a set of object properties that define the view's layout
position, orientation, transparency and more.</p>

<p>For more information, read the <a
href="../../guide/topics/graphics/animation.html">Property Animation</a> document.</p>


<h3>Enable hardware acceleration</h3>

<p>Android 3.0 adds a hardware-accelerated OpenGL renderer that gives a performance boost to most 2D
graphics operations. You can enable hardware-accelerated rendering in your application by setting
<code>android:hardwareAccelerated="true"</code> in your manifest's <a
href="../../guide/topics/manifest/application-element.html"><code>&lt;application&gt;</code></a>
element or for individual <a href="../../guide/topics/manifest/activity-element.html"><code>&lt;activity&gt;</code></a> elements. Hardware acceleration results in smoother animations, smoother
scrolling, and overall better performance and response to user interaction. When enabled, be sure
that you thoroughly test your application on a device that supports hardware acceleration.</p>


<h3>Enhance your app widgets</h3>

<p>App widgets allow users to access information from your application directly from the Home
screen and interact with ongoing services (such as preview their email and control music playback).
Android 3.0 enhances these capabilities by enabling collections, created with widgets such as
<code><a href="../../reference/android/widget/ListView.html">ListView</a></code>, <code><a href="../../reference/android/widget/GridView.html">GridView</a></code>, and the new <code><a href="../../reference/android/widget/StackView.html">StackView</a></code>. These widgets allow you to create more interactive app
widgets, such as one with a scrolling list, and can automatically update their data through a <code><a href="../../reference/android/widget/RemoteViewsService.html">RemoteViewsService</a></code>.</p>

<p>Additionally, you should create a preview image of your app widget using the Widget Preview
application (pre-installed in an Android 3.0 AVD) and reference it with the <code><a href="../../reference/android/appwidget/AppWidgetProviderInfo.html#previewImage">android:previewImage</a></code> attribute, so that users
can see what the app widget looks like before adding it to their Home screen.</p>


<h3>Add other new features</h3>

<p>Android 3.0 introduces many more APIs that you might find valuable for your
application, such as drag and drop APIs, new Bluetooth APIs, a system-wide clipboard framework, a
new graphics engine called Renderscript, and more.</p>

<p>To learn more about the APIs mentioned above and more, see the <a
href="../../sdk/android-3.0.html">Android 3.0 Platform</a> document.</p>


<h3>Look at some samples</h3>

<p>Many of the new features and APIs that are described above and in the <a
href="../../sdk/android-3.0.html#api">Android 3.0 Platform</a> document also have accompanying
samples that allow you to preview the effects and can help you understand how to use them. To get
the samples, download them from the SDK repository <a href="../../sdk/adding-components.html"
>using the Android SDK and AVD Manager</a>. After downloading the samples ("Samples for SDK API
11"), you can find them in <code>&lt;sdk_root&gt;/samples/android-11/</code>. The following list
provides links to the browsable source code for some of the samples:</p>

<ul>
  <li><a href="../../resources/samples/HoneycombGallery/index.html">Honeycomb Gallery</a>:
Demonstrates many new APIs in Android 3.0, including fragments, the action bar, drag and drop, and
animations.</li>
  <li><a
href="../../resources/samples/ApiDemos/src/com/example/android/apis/app/index.html#Fragment">
Fragments</a>: Various samples that demonstrate fragment layouts, back stack, restoring state, and
more.</li>
  <li><a
href="../../resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarMechanics.html"
>Action Bar</a>: Samples that demonstrate various Action Bar features, such as tabs, logos, and
action items.</li>
  <li><a
href="../../resources/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.
html">Clipboard</a>: An example of how to use the clipboard for copy and paste operations.</li>
  <li><a
href="../../resources/samples/ApiDemos/src/com/example/android/apis/view/DragAndDropDemo.html">
Drag and Drop</a>: An example of how to perform drag and drop with new View events.</li>
  <li><a href="../../resources/samples/ApiDemos/src/com/example/android/apis/view/List15.html">
Multi-choice List</a>: An example of how to provide multiple-choice selection for ListView and
GridView.</li>
  <li><a
href="../../resources/samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.html">
Content Loaders</a>: An example using new Loader APIs to asynchronously load data.</li>      
  <li><a
href="../../resources/samples/ApiDemos/src/com/example/android/apis/animation/index.html">
Property Animation</a>: Several samples using the new animation APIs to animate object
properties.</li>
  <li><a
href="../../resources/samples/ApiDemos/src/com/example/android/apis/view/SearchViewActionBar.
html">Search View Widget</a>: Example using the new search widget in the Action Bar (as an
"action view").</li>
  <li><a
href="../../resources/samples/Renderscript/index.html">Renderscript</a>: Contains several
different applications that demonstrate using renderscript APIs for computations and 3D
graphics.</li>
</ul>



<h2 id="ManagingAppDist">Managing App Distribution Based on Screen Configuration</h2>

<p>If your manifest file has either <a
href="../../guide/topics/manifest/uses-sdk-element.html#min"><code>android:minSdkVersion</code></a>
or <a href="../../guide/topics/manifest/uses-sdk-element.html#target"><code>android:targetSdkVersion</code></a> set to <code>"4"</code> or higher, then the Android system will scale your
application's layout and assets to fit the current device screen, whether the device screen is
smaller or larger than the one for which you originally designed your application. As such, you
should always test your application on real or <a
href="../../guide/developing/devices/index.html">virtual devices</a> with various screen sizes
and densities.</p>

<p>Although we recommend that you design your application to function properly on multiple
configurations of screen size and density, you can instead choose to limit the distribution of your
application to certain types of screens, such as only tablets or only mobile devices. To do so, you
can add elements to your Android manifest file that enable filtering based on screen configuration
by external services such as Android Market.</p>

<p>However, before you decide to restrict your application to certain screen configurations, you
should understand the techniques for <a
href="../../guide/practices/screens_support.html">supporting multiple screens</a> and employ
them to the best of your ability. By supporting multiple screens, your application can be made
available to the greatest number of users with different devices.</p>


<h3 id="FilteringTabletApps">Filtering a tablet application from mobile devices</h3>

<p>If the system scaling adversely affects your application UI when scaling your application down
for smaller screens, you should add <a
href="../../guide/topics/resources/providing-resources.html#AlternativeResources">alternative
layouts</a> for smaller screens to adjust your layout. However, sometimes your layout still might
not fit a smaller screen or you've explicitly designed your application only for tablets and other
large devices. In this case, you can manage the availability of your application to smaller screens
by using the <a href="../../guide/topics/manifest/supports-screens-element.html"><code>&lt;supports-screens></code></a> manifest element.</p>

<p>For example, if you want your application to be available only to extra large
screens, you can declare the element in your manifest like this:</p>

<pre>
&lt;manifest ... >
    ...
    &lt;supports-screens android:smallScreens="false"
                      android:normalScreens="false"
                      android:largeScreens="false"
                      android:xlargeScreens="true" /&gt;
    &lt;application ... >
        ...
    &lt;application>
&lt;/manifest>
</pre>

<p>External services such as Android Market read this manifest element and use it to ensure that
your application is available only to devices with an extra large screen.</p>

<p class="note"><strong>Note:</strong> If you use the <a
href="../../guide/topics/manifest/supports-screens-element.html"><code>&lt;supports-screens></code></a> element for the reverse scenario (when your application is not compatible
with <em>larger</em> screens) and set the larger screen size attributes to <code>"false"</code>, then
external services such as Android Market <strong>do not</strong> apply filtering. Your application
will still be available to larger screens, but when it runs, it will not fill the screen&mdash;the
system will draw it in a "postage stamp" window that's the same relative size as the screen size
that your application does support. If you want to prevent your application from being downloaded on
larger screens, see the following section.</p>


<h3 id="FilteringMobileApps">Filtering a mobile device application from tablets</h3>

<p>Because Android automatically scales applications to fit larger screens, you shouldn't
need to filter your application from larger screens. However, you might discover that your
application can't scale up or perhaps you've decided to publish two versions of your application
that each deliver different features for different screen configurations, so you don't want
larger devices to download the version designed for smaller screens. In such a case, you can
use the <a href="../../guide/topics/manifest/compatible-screens-element.html"><code>&lt;compatible-screens></code></a> element to manage the distribution of your application based on the
combination of screen size and density. External services such as
Android Market uses this information to apply filtering to your application, so that only devices
that have a screen configuration with which you declare compatibility can download your
application.</p>

<p>The <a href="../../guide/topics/manifest/compatible-screens-element.html"><code>&lt;compatible-screens></code></a> element must contain one or more <code>&lt;screen&gt;</code> elements,
which each specify a screen configuration with which your application is compatible, using both
the <code>android:screenSize</code> and <code>android:screenDensity</code> attributes. Each <code>&lt;screen&gt;</code> element <strong>must include both attributes</strong> to specify an individual
screen configuration&mdash;if either attribute is missing, then the element is invalid
(external services such as Android Market will ignore it).</p>

<p>For example, if your application is compatible with only small and normal screens, regardless
of screen density, then you must specify eight different <code>&lt;screen&gt;</code> elements,
because each screen size has four density configurations. You must declare each one of
these; any combination of size and density that you do <em>not</em> specify is considered a screen
configuration with which your application is <em>not</em> compatible. Here's what the manifest
entry looks like if your application is compatible with only small and normal screens:</p>

<pre>
&lt;manifest ... >
    ...
    &lt;compatible-screens>
        &lt;!-- all small size screens -->
        &lt;screen android:screenSize="small" android:screenDensity="ldpi" />
        &lt;screen android:screenSize="small" android:screenDensity="mdpi" />
        &lt;screen android:screenSize="small" android:screenDensity="hdpi" />
        &lt;screen android:screenSize="small" android:screenDensity="xhdpi" />
        &lt;!-- all normal size screens -->
        &lt;screen android:screenSize="normal" android:screenDensity="ldpi" />
        &lt;screen android:screenSize="normal" android:screenDensity="mdpi" />
        &lt;screen android:screenSize="normal" android:screenDensity="hdpi" />
        &lt;screen android:screenSize="normal" android:screenDensity="xhdpi" />
    &lt;/compatible-screens>
    &lt;application ... >
        ...
    &lt;application>
&lt;/manifest>
</pre>

<p class="note"><strong>Note:</strong> Although you can also use the <a
href="../../guide/topics/manifest/compatible-screens-element.html"><code>&lt;compatible-screens></code></a> element for the reverse scenario (when your application is not
compatible with smaller screens), it's easier if you instead use the <a
href="../../guide/topics/manifest/supports-screens-element.html"><code>&lt;supports-screens></code></a> as discussed in the previous section, because it doesn't require you
to specify each screen density your application supports.</p>

<p>Remember, you should strive to make your application available to as many devices as possible by
applying all necessary techniques for <a
href="../../guide/practices/screens_support.html">supporting multiple screens</a>. You should
then use the <a href="../../guide/topics/manifest/compatible-screens-element.html"><code>&lt;compatible-screens></code></a> element to filter your application from certain devices only when you
cannot offer compatibility on all screen configurations or you have decided to provide
multiple versions of your application, each for a different set of screen configurations.</p>



<h2 id="Issues">Other Issues</h2>

<p>Whether you decide to optimize or upgrade your application for tablet-type devices, you
should be aware that the functionality and availability of your application on new devices
might be affected by the following issues:</p>

<ul>
  <li><a href="#Landscape">Tablets are often designed for use in the landscape orientation</a>
  <p>Tablets and similar devices often have a screen that uses the landscape orientation
by default. If your application assumes a portrait orientation or locks into portrait
orientation, you should update your application to support landscape.</p></li>
  <li><a href="#Telephony">Not all devices have telephony or other features</a>
  <p>If your application declares the <code>"android.hardware.telephony"</code> feature in the manifest,
then it will not be available to devices that do not offer telephony (such as tablets), based on
Android Market filtering. If your application can function properly without telephony, you should
update your application to gracefully disable the telephony features when not available on a
device.</p></li>
</ul>


<h3 id="Landscape">Adding support for landscape screens</h3>

<p>Although tablets can rotate to operate in any orientation, they are often designed for
landscape orientation and that is how most users will use them. So, you should ensure that your
application can function in landscape. Even if you want to avoid rotating the screen while your
application is running, you should not assume that portrait is the device's default orientation. You
should either ensure that your layout is usable in both portrait and landscape orientations or
provide an <a href="../../guide/topics/resources/providing-resources.html#AlternativeResources" 
>alternative layout resource</a> for landscape orientation.</p>

<p>If you believe your application or game provides its best experience when the screen is tall,
consider that tablets and similar devices have a screen that's as tall or taller in landscape
orientation than a phone in portrait orientation. With that in mind, you might be able to add a
landscape design that adds padding or extra landscape scenery on the left and right sides, so
the primary screen space still remains taller than it is wide.</p>

<p>Ideally, your application should handle all orientation changes instead of locking into one
orientation. When the user rotates the screen, the system restarts the current activity by calling
<code><a href="../../reference/android/app/Activity.html#onDestroy()">onDestroy()</a></code> and <code><a href="../../reference/android/app/Activity.html#onCreate(android.os.Bundle)">onCreate()</a></code>) in immediate succession. You should design your activity to account for these changes
in the lifecycle, so the activity can save and restore its state. You can learn about the
necessary lifecycle callback methods and how to save and restore the activity state in the <a
href="../../guide/topics/fundamentals/activities.html#Lifecycle">Activities</a>
document. If your activity state is more complex and cannot retain it using the normal
lifecycle callback methods, you can use alternative techniques described in <a
href="../../guide/topics/resources/runtime-changes.html">Handling Runtime Changes</a>.</p>

<p>In the worst-case scenario, however, you can avoid orientation changes by using the <a
href="../../guide/topics/manifest/activity-element.html#screen"><code>android:screenOrientation</code></a> attribute in the <a
href="../../guide/topics/manifest/activity-element.html"><code>&lt;activity&gt;</code></a>
element. Instead of locking the orientation in landscape or portrait, however, you should
specify a value of <code>"nosensor"</code>. This way, your activity uses whatever orientation the
device specifies as its natural orientation and the screen will not rotate. You should still
avoid using the <a
href="../../guide/topics/manifest/activity-element.html#screen"><code>android:screenOrientation</code></a> attribute, but because it's sometimes necessary to lock the
screen into one orientation, it's best if you do so in a way that uses the device's natural
orientation instead of assuming one specific orientation.</p>

<p>If your application uses the orientation sensors, such as the accelerometer (with the <code><a href="../../reference/android/hardware/SensorManager.html">SensorManager</a></code> APIs), also be aware that the landscape screen can also cause
problems, due to false assumptions about which orientation is the natural position. For more
information about how you should properly handle rotation changes when using the orientation
sensors, read the blog post, <a
href="http://android-developers.blogspot.com/2010/09/one-screen-turn-deserves-another.html">One
Screen Turn Deserves Another</a>.</p>



<h3 id="Telephony">Using telephony or other variable features</h3>

<p>Tablets and similar devices might not include support for telephony, so they can't make
traditional phone calls or handle SMS. Some devices might also omit
other hardware features, such as Bluetooth. If your application uses these features, then your
manifest file probably already includes (or should include) a declaration of the feature with the <a
href="../../guide/topics/manifest/uses-feature-element.html"><code>&lt;uses-feature&gt;</code></a>
element. Doing so prevents devices that do not declare support for the feature from downloading
your applications. For example:</p>

<pre>&lt;uses-feature android:name="android.hardware.telephony" /></pre>

<p>By default, this declares that your application <em>requires</em> telephony features. So,
external services such as Android Market use this information to filter your application from
devices that do not offer telephony.</p>

<p>If, however, your application uses, but does not require the feature, you should
add to this element, <code>android:required="false"</code>. For example:</p>

<pre>&lt;uses-feature android:name="android.hardware.telephony" android:required="false" /></pre>

<p>This indicates that your application uses the feature, but is still functional if the feature is
not available. So, it should still be available to devices that don't provide telephony hardware
(or telephony features), such as tablets.</p>

<p>Then in your application code, you must gracefully disable the features that use telephony
when it's not available. You can check whether the feature is available using <code><a href="../../reference/android/content/pm/PackageManager.html#hasSystemFeature(java.lang.String)">PackageManager.hasSystemFeature()</a></code>. For
example:</p>

<pre>
PackageManager pm = getPackageManager();
boolean hasTelephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
</pre>

<p>For more information about these
issues and how to future-proof your application for different hardware, read the blog post <a
href="http://android-developers.blogspot.com/2010/10/five-steps-to-future-hardware-happiness.html">
The Five Steps to Future Hardware Happiness</a>.</p>
    </div>

  <a href="#top" style="float:right">&uarr; Go to top</a>
  
  </div>

<div id="footer">


  <div id="copyright">
    
  Except as noted, this content is licensed under <a
  href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>. 
  For details and restrictions, see the <a href="../../license.html">
  Content License</a>.
  </div>
  <div id="build_info">
    
  Android 4.0&nbsp;r1 - 17 Oct 2011 18:17

  </div>

  <div id="footerlinks">
    
  <p>
    <a href="http://www.android.com/terms.html">Site Terms of Service</a> -
    <a href="http://www.android.com/privacy.html">Privacy Policy</a> -
    <a href="http://www.android.com/branding.html">Brand Guidelines</a>
  </p>
  </div>

</div> <!-- end footer -->

</div><!-- end doc-content -->

</div> <!-- end body-content --> 

<script type="text/javascript">
init(); /* initialize android-developer-docs.js */
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5831155-1");
pageTracker._trackPageview();
</script>

</body>
</html>



